package temp;

public class Temp  {
	private static int count;
	private int type;
	private int num;

	public String toString() {
		if (type < 9)
			switch (type) {
			case 1 : return "$fp";
			case 2 : return "$sp";
			case 3 : return "$a0";
			case 4 : return "$a1";
			case 5 : return "$a2";
			case 6 : return "$a3";
			case 7 : return "$v0";
			case 8 : return "$ra";
			default : return "t" + num;
			}
		else if (type < 17)
			return "$s" + (type - 9);
		else if (type < 37)
			return "$t" + (type - 17);
		else
			return "$v1";
			
	}

	public Temp() {
		type = 0;
		num=count++;
	}

	public Temp(int t) {
		type = t;
		if (t == 0) num = count++; 
	}

	public int getType() {
		return type;
	}
}

